<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>[%$softtitle%]</title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/clickmenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodyauto")){
			$('.manageadd').css({height:h-40});
			$('.manageedit').css({height:h-40});
		}
	}
	var formmain_attr_js_typename_empty  = "[%$ST.formmain_attr_js_typename_empty%]";
	var formmain_attr_js_attrvalue_empty  = "[%$ST.formmain_attr_js_attrvalue_empty%]";
	var formmain_attr_js_attrsize_empty  = "[%$ST.formmain_attr_js_attrsize_empty%]";
	var formmain_attr_js_attrrow_empty  = "[%$ST.formmain_attr_js_attrrow_empty%]";
	var formmain_attr_js_attrlenther_empty  = "[%$ST.formmain_attr_js_attrlenther_empty%]";
	var formmain_attr_js_validatetext_empty  = "[%$ST.formmain_attr_js_validatetext_empty%]";
	var formmain_js_attr_edit_ok = "[%$ST.formmain_js_attr_edit_ok%]";
	var formmain_js_attr_edit_no = "[%$ST.formmain_js_attr_edit_no%]";
	var iframename = "[%$iframename%]";
	$(document).ready(function(){
		var h = '[%$iframeheightwindow%]';
		$('.manageadd').css({height:h-40});
		var options = {
			beforeSubmit: formverify,
			success:saveResponse
		}
		$('#formattedit').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['typename']==""){
			document.formattedit.typename.focus();
			alert(formmain_attr_js_typename_empty);
			return false;
		}
		if (get['isline']!=1){
			if(get['inputtype']=="select" || get['inputtype']=="radio" || get['inputtype']=="checkbox"){
				if(get['attrvalue']==""){
					document.formattedit.attrvalue.focus();
					alert(formmain_attr_js_attrvalue_empty);
					return false;
				}
			}
			if(get['attrsize']!=""){
				if(get['attrsize'].match(/^[1-9]{1}[0-9]{0,2}$/ig)==null) {
					document.formattedit.attrsize.focus();
					alert(formmain_attr_js_attrsize_empty);
					return false;
				}
			}
			if(get['isvalidate']==1){
				if(get['validatetext']=='') {
					document.formattedit.validatetext.focus();
					alert(formmain_attr_js_validatetext_empty);
					return false;
				}
			}
			if(get['attrrow']!=""){
				if(get['attrrow'].match(/^[1-9]{1}[0-9]{0,2}$/ig)==null) {
					document.formattedit.attrrow.focus();
					alert(formmain_attr_js_attrrow_empty);
					return false;
				}
			}
			if(get['attrlenther']!=""){
				if(get['attrlenther'].match(/^[1-9]{1}[0-9]{0,2}$/ig)==null) {
					document.formattedit.attrlenther.focus();
					alert(formmain_attr_js_attrlenther_empty);
					return false;
				}
			}
		}
		parent.windowsdig('Loading','iframe:index.php?archive=management&action=load','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			parent.frames[iframename].refresh('modelattselectform','selectall2','check_all2');
			alert(formmain_js_attr_edit_ok);
		}else{
			alert(formmain_js_attr_edit_no);
		}
		parent.onaletdoc()
	}
</script>
</head>

<body>
<form name="formattedit" id="formattedit" method="post" action="index.php?archive=formmain&action=formattrsave">
	<input type="hidden" name="inputclass" value="edit">
	<input type="hidden" name="fgid" value="[%$attrread.fgid%]">
	<input type="hidden" name="faid" value="[%$attrread.faid%]">
	<div id="mainbodyauto" class="manageadd">
		<div class="maindobycontent">
			<!--查看已选择的类型-->
			<div class="suggestion">
				<span class="sugicon"><span class="strong colorgorning2">[%$ST.position_title%]</span><span class="colorgorningage">[%$ST.formmain_attr_edit_mess%] <u>[%$attrread.typename%] ([%$attrread.attrname%])</u></span></span>
			</div>
			<div class="sugtitle">
				<span class="sugtitleicon"><span class="strong colorgorning2">[%$ST.formmain_attr_add_modenametype%]</span></span>
			</div>
			<div class="sugtitle-line"></div>
			<div class="formdiv">
				<table border="0" width="100%">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_typename%]</td>
						<td width="85%" class="trtitle02"><input type="text" name="typename" size="25" maxlength="25" value="[%$attrread.typename%]" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_typename_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_typeremark%]</td>
						<td width="85%" class="trtitle02"><input type="text" name="attrcue" size="50" maxlength="50" value="[%$attrread.attrcue%]" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_typeremark_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_isline%]</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="isline" [%if $attrread.isline==1%] checked="checked"[%/if%] onclick="ondisplay('attrmorndiv','displaynone')"/> [%$ST.is_yes%]&nbsp;
							<input type="radio" value="0" name="isline" [%if $attrread.isline==0%] checked="checked"[%/if%] onclick="ondisplay('attrmorndiv','displaytrue')"/> [%$ST.is_no%]
							<span class="cautiontitle">[%$ST.formmain_attr_add_isline_mess%]</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="[%if $attrread.isline==1%]displaynone[%else%]displaytrue[%/if%]" id="attrmorndiv">
				<div class="sugtitle">
					<span class="sugtitleicon"><span class="strong colorgorning2">[%$ST.formmain_attr_add_typevalue%]</span></span>
				</div>
				<div class="sugtitle-line"></div>
				<div class="formdiv">
					<table border="0" width="100%">
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_inputtype%]</td>
							<td width="85%" class="trtitle02">
								<select name="inputtype" id="inputtype">
									[%forlist from=$formtypelist key=i%]
									<option [%if $attrread.inputtype==$formtypelist[i].key%]selected [%/if%]value="[%$formtypelist[i].key%]">[%$formtypelist[i].name%]</option>
									[%/forlist%]
								</select>
							</td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_attrvalue%]</td>
							<td width="85%" class="trtitle02">
								<textarea name="attrvalue" cols="40" rows="5" class="infoInput">[%$attrread.attrvalue%]</textarea>
								<span class="cautiontitle">[%$ST.formmain_attr_add_attrvalue_mess%]</span>
							</td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_isvalidate%]</td>
							<td width="85%" class="trtitle02">
								<input type="radio" value="1" name="isvalidate"[%if $attrread.isvalidate==1%] checked="checked"[%/if%] onclick="ondisplay('validatetextdiv','trstyle2 displaytrue')"/> [%$ST.open_botton_title%]&nbsp;
								<input type="radio" value="0" name="isvalidate"[%if $attrread.isvalidate==0%] checked="checked"[%/if%] onclick="ondisplay('validatetextdiv','trstyle2 displaynone')"/> [%$ST.close_botton_title%]
								<span class="cautiontitle">[%$ST.formmain_attr_add_isvalidate_mess%]</span>
							</td>
						</tr>
						<tr class="trstyle2 [%if $attrread.isvalidate==1%]displaytrue[%else%]displaynone[%/if%]" id="validatetextdiv">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_validatetext%]</td>
							<td width="85%" class="trtitle02"><input type="text" name="validatetext" value="[%$attrread.validatetext%]" size="40" maxlength="80" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_validatetext_mess%]</span></td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_attrsize%]</td>
							<td width="85%" class="trtitle02"><input type="text" name="attrsize" value="[%$attrread.attrsize%]" size="6" maxlength="3" value="20" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_attrsize_mess%]</span></td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_attrrow%]</td>
							<td width="85%" class="trtitle02"><input type="text" name="attrrow" size="6" value="[%$attrread.attrrow%]" maxlength="3" value="5" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_attrrow_mess%]</span></td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_attrlenther%]</td>
							<td width="85%" class="trtitle02"><input type="text" name="attrlenther" value="[%$attrread.attrlenther%]" size="6" maxlength="3" value="50" class="infoInput"/> <span class="cautiontitle">[%$ST.formmain_attr_add_attrlenther_mess%]</span></td>
						</tr>
						<tr class="trstyle2">
							<td width="15%" class="trtitle01">[%$ST.formmain_attr_add_iscount%]</td>
							<td width="85%" class="trtitle02">
								<input type="radio" value="1" name="iscount" [%if $attrread.iscount==1%] checked="checked"[%/if%]/> [%$ST.open_botton_title%]&nbsp;
								<input type="radio" value="0" name="iscount" [%if $attrread.iscount==0%] checked="checked"[%/if%]/> [%$ST.close_botton_title%]
								<span class="cautiontitle">[%$ST.formmain_attr_add_iscount_mess%]</span>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</div>
	<div id="downbotton">
		<div id="subbotton">
			<table border="0" width="100%">
				<tr>
					<td id="right"><input type="submit" name="Submit" value="[%$ST.botton_edit%]" class="buttonface" /></td>
					<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="[%$ST.botton_edit_reset%]" class="buttonface" /></td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>

</html>